package com.example.util;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.example.mall.Order;
import com.example.mall.Product;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName MockData
 * @Description TODO
 * @Author: XMK
 * @Date: 2020/4/3 11:55
 * @Version: 1.0
 */
public class MockData {
    public static List<Product> products() {
        List<Product> products = new ArrayList<>();

        Product p1 = new Product();
        p1.setId(1L);
        p1.setPrice(10.2);
        p1.setProductName("iphone1");
        products.add(p1);

        Product p2 = new Product();
        p2.setId(2L);
        p2.setPrice(20.2);
        p2.setProductName("sumsun");
        products.add(p2);

        return products;
    }

    public static Product getOneProduct() {
        Product p1 = new Product();
        p1.setId(1L);
        p1.setPrice(10.2);
        p1.setProductName("iphone1");
        p1.setProductNo(IdUtil.fastSimpleUUID());

        return p1;
    }

    public static Product getProduct(String productNo) {
        Product p1 = new Product();
        p1.setId(1L);
        p1.setPrice(10.2);
        p1.setProductName("iphone1");
        p1.setProductNo(productNo);

        return p1;
    }

    public static Order getOrder(String orderNo) {
        Order order = new Order();
        order.setCreateTime(DateUtil.date());
        order.setOrderNo(orderNo);
//        order.setProductNo(IdUtil.fastSimpleUUID());
        order.setProductNo("asdfe213");
        return order;
    }
}
